import request from '@/utils/request'

/**
 * 获取新闻列表
 */
export function getNewsList(data) {
  return request({
    url: '/news/GetNewsList',
    method: 'post',
    data
  })
}

export function getAllNewsTypeList() {
  return request({
    url: '/newsType/GetAllNewsTypeList',
    method: 'post'
  })
}

export function addNews(data) {
  return request({
    url: '/news/addNews',
    method: 'post',
    data
  })
}

export function updateNews(data) {
  return request({
    url: `/news/updateNews`,
    method: 'post',
    data
  })
}

export function deleteNews(id) {
  return request({
    url: `/news/deleteNews?id=` + id,
    method: 'post'
  })
}

/**
 * 更新新闻发布状态
 * @param {*} id 新闻id
 * @param {*} status 更新后的新闻状态
 */
export function publishModel(id, status) {
  return request({
    url: `/news/PublishNews?id=` + id + '&status=' + status,
    method: 'post'
  })
}

export function TopModel(id, status) {
  return request({
    url: `/news/TopModel?id=` + id + '&status=' + status,
    method: 'post'
  })
}

